package com.jinyu.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jinyu.entity.SelectKwLED;
import com.jinyu.mapper.SelectKwLEDMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author：chenjl
 * @Date：2023/9/19 11:21
 */
@Service
public class SelectKwLEDServiceImpl implements SelectKwLEDService{

    @Autowired
    private SelectKwLEDMapper selectKwLEDMapper;
    @Override
    public List<Map<String,Object>> getLedAll(Integer offset,Integer size) {
        List<SelectKwLED> list =  selectKwLEDMapper.getLedAll(offset,size);

        List<Map<String,Object>> listMap = new ArrayList<>();


        for(int i = 0; i < list.size(); i++) {
            Map<String, Object> map = new HashMap<String, Object>();
            map.put("0", list.get(i).getColour());
            map.put("1", list.get(i).getMatername());
            map.put("2", list.get(i).getBatchNo());
            map.put("3", list.get(i).getKw());
            map.put("4", list.get(i).getPiecenum().toString());
            listMap.add(map);
        }

        return listMap;

    }

    @Override
    public int getLedAllCount() {
        return selectKwLEDMapper.getLedAllCount();
    }


}
